/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package aplicacao;

import br.edu.GenericDAO;
import br.edu.HibernateUtil;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Restrictions;
import vacina.Vacina;

/**
 *
 * @author Max Weber
 */
public class AplicacaoDAO extends GenericDAO<Aplicacao>{

    private Session sessao;
    private Transaction transacao;
    private Class classe;
    
    public AplicacaoDAO() {
        super(Aplicacao.class);
    }
    
    public Aplicacao pesquisarCodigo(int codigo) {
        sessao = HibernateUtil.getSessionFactory().openSession();
        transacao = sessao.beginTransaction();

        Aplicacao aplicacao
                = (Aplicacao) sessao.createCriteria(Aplicacao.class).add(Restrictions.eq("id_aplicacao", codigo)).uniqueResult();
        sessao.close();
        return aplicacao;
    }
}